<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!-- 使用JSTL标签需要引入的头文件 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!-- 使用fmt 对时间进行格式化的时候需要引入的头文件 -->
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<title>#[[$Title$]]#</title>
<script type="text/javascript">
    function diaryTypeDelete(diaryTypeId){
        if(confirm("您确定要删除这个日志类别吗？")){
            window.location="diaryType?action=delete&diaryTypeId="+diaryTypeId;
        }
    }
</script>
</head>
<body>
<div class="data_list">
    <div class="data_list_title">
        <img src="${pageContext.request.contextPath}/images/list_icon.png"/>
        日记类别列表
        <span class="diaryType_add">
			<button class="btn btn-primary btn-success" type="button" onclick="javascript:window.location='diaryType?action=preSave'">添加日志类别</button>
		</span>
    </div>

    <div>
        <table class="table table-hover table-striped">
            <tr>
                <th>编号</th>
                <th>类别名称</th>
                <th>操作</th>
            </tr>
            <c:forEach var="diaryType" items="${diaryTypeList }">
                <tr>
                    <td>${diaryType.diaryTypeId }</td>
                    <td>${diaryType.typeName }</td>
                    <td>
                        <button class="btn btn-primary btn-info" type="button" onclick="javascript:window.location='diaryType?action=preSave&diaryTypeId=${diaryType.diaryTypeId }'">修改</button>&nbsp;
                        <button class="btn btn-primary btn-danger" type="button" onclick="diaryTypeDelete(${diaryType.diaryTypeId })">删除</button>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </div>
<%--显示错误信息--%>
<div align="center"><font color="red">${error }</font></div>
</div>
</body>
</html>